'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  //注册

  router.post('/api/registry',controller.user.registry);
  //登录

  router.post('/api/login',controller.user.login);

  //添加购物车  restful

  router.resources('/api/car',controller.car);

  //清空购物车
  router.delete('/api/allDel',controller.car.allDel);

  //获取分类
  router.get('/api/classify',controller.classify.getClassify);

  //let ids = 1,2,3,4,5

// delete from carlist where id in (3)
  //验证码
  router.get('/api/code',controller.user.code);

  //获取商品列表  1》获取全部的     2》要分类  classify_id
  router.get('/api/productList',controller.product.list);

  //获取商品详情
  router.get('/api/detail',controller.product.detail);

  //搜索
  router.get('/api/search',controller.product.search);
};
